package com.example.disruptor.demo.disruptor;

import com.lmax.disruptor.EventTranslatorOneArg;
import lombok.extern.slf4j.Slf4j;

import java.text.MessageFormat;

/**
 * 生产者
 * 事件转换
 * Created by liunanhua on 2018/7/19.
 */
@Slf4j
public class LongEventTranslator1 implements EventTranslatorOneArg<LongEvent, Long> {

    @Override
    public void translateTo(LongEvent event, long sequence, Long data) {
        log.info(MessageFormat.format("生产者生产数据data = {0}, seq = {1}", data, sequence));
        event.setValue(data);
    }
}
